<?php
/**
 * ShopEx licence
 *
 * @copyright  Copyright (c) 2005-2010 ShopEx Technologies Inc. (http://www.shopex.cn)
 * @license  http://ecos.shopex.cn/ ShopEx License
 */
 
function widget_hotbrandlist(&$setting,&$smarty){

    $limit=intval($setting['limit'])?intval($setting['limit']):10;
    $maxlength=intval($setting['maxlength'])?intval($setting['maxlength']):55;
    //$setting['fontStyle']=type_check2($setting['fontStyle']);
    //$setting['fontStyle2']=type_check2($setting['fontStyle2']);
    $order = array($setting['ranking']);
    $viewer = app::get('b2c')->getConf('gallery.default_view');
    $o = app::get('b2c')->model('goods');
    $oSearch = app::get('b2c')->model('search');
    $rk['view_w_count']=4;
    $rk['view_count']=5;
    $rk['buy_count']=6;
    $rk['buy_w_count']=7;
    $rk['comments_count']=8;
    parse_str($setting['adjunct']['items'][0],$filter);
        $filter = getFilter_hotbrandlist($filter);

    $setting['link']=kernel::router()->gen_url(array('app'=>'b2c', 'ctl'=>'site_gallery', 'act'=>'index','full'=>1,'args'=>array($filter['cat_id'],$oSearch->encode($filter),$rk[$setting['ranking']]?$rk[$setting['ranking']]:0)));
    //$result=$o->getList("*",$filter,0,$limit,$c,$order);
    if(!empty($setting['ranking']))
        $result=$o->getList("*",$filter,0,$limit,$order);
    else
        $result=$o->getList("*",$filter,0,$limit);
    return $result;
}
function getFilter_hotbrandlist($filter){
    $filter = array_merge(array('marketable'=>"true",'disabled'=>"false",'goods_type'=>"normal"),$filter);
    if($GLOBALS['runtime']['member_lv']){
        $filter['mlevel'] = $GLOBALS['runtime']['member_lv'];
    }
    if($filter['props']){
        foreach($filter['props'] as $k=>$v){
            $filter['p_'.$k]=$v[0];
        }
    }
    return $filter;
}


?>
